home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / interp / coll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-15  |  3.3 KB  |  99 lines  |  [TEXT/ttxt]

  1. /**********************************************************************\
  2. *
  3. *  Copyright (c) 1994  Carnegie Mellon University
  4. *  All rights reserved.
  5. *  
  6. *  Use and copying of this software and preparation of derivative
  7. *  works based on this software are permitted, including commercial
  8. *  use, provided that the following conditions are observed:
  9. *  
  10. *  1. This copyright notice must be retained in full on any copies
  11. *     and on appropriate parts of any derivative works.
  12. *  2. Documentation (paper or online) accompanying any system that
  13. *     incorporates this software, or any part of it, must acknowledge
  14. *     the contribution of the Gwydion Project at Carnegie Mellon
  15. *     University.
  16. *  
  17. *  This software is made available "as is".  Neither the authors nor
  18. *  Carnegie Mellon University make any warranty about the software,
  19. *  its performance, or its conformity to any specification.
  20. *  
  21. *  Bug reports, questions, comments, and suggestions should be sent by
  22. *  E-mail to the Internet address "gwydion-bugs@cs.cmu.edu".
  23. *
  24. ***********************************************************************
  25. *
  26. * $Header: coll.c,v 1.6 94/10/05 21:01:28 nkramer Exp $
  27. *
  28. * This file implements the collection framework.
  29. *
  30. \**********************************************************************/
  31.  
  32. #include "../compat/std-c.h"
  33.  
  34. #include "mindy.h"
  35. #include "class.h"
  36. #include "obj.h"
  37. #include "gc.h"
  38. #include "coll.h"
  39.  
  40. obj_t obj_CollClass = 0;
  41. obj_t obj_ExKeyCollClass = 0;
  42. obj_t obj_MutCollClass = 0;
  43. obj_t obj_SeqClass = 0;
  44. obj_t obj_MutExKeyCollClass = 0;
  45. obj_t obj_MutSeqClass = 0;
  46. obj_t obj_ArrayClass = 0;
  47. obj_t obj_VectorClass = 0;
  48. obj_t obj_StringClass = 0;
  49.  
  50.  
  51. /* GC stuff. */
  52.  
  53. void scavenge_coll_roots(void)
  54. {
  55.     scavenge(&obj_CollClass);
  56.     scavenge(&obj_ExKeyCollClass);
  57.     scavenge(&obj_MutCollClass);
  58.     scavenge(&obj_SeqClass);
  59.     scavenge(&obj_MutExKeyCollClass);
  60.     scavenge(&obj_MutSeqClass);
  61.     scavenge(&obj_ArrayClass);
  62.     scavenge(&obj_VectorClass);
  63.     scavenge(&obj_StringClass);
  64. }
  65.  
  66.  
  67. /* Init stuff. */
  68.  
  69. void make_coll_classes(void)
  70. {
  71.     obj_CollClass = make_abstract_class(FALSE);
  72.     obj_ExKeyCollClass = make_abstract_class(FALSE);
  73.     obj_MutCollClass = make_abstract_class(FALSE);
  74.     obj_SeqClass = make_abstract_class(FALSE);
  75.     obj_MutExKeyCollClass = make_abstract_class(FALSE);
  76.     obj_MutSeqClass = make_abstract_class(FALSE);
  77.     obj_ArrayClass = make_abstract_class(FALSE);
  78.     obj_VectorClass = make_abstract_class(FALSE);
  79.     obj_StringClass = make_abstract_class(FALSE);
  80. }
  81.  
  82. void init_coll_classes(void)
  83. {
  84.     init_builtin_class(obj_CollClass, "<collection>", obj_ObjectClass, NULL);
  85.     init_builtin_class(obj_ExKeyCollClass, "<explicit-key-collection>",
  86.                obj_CollClass, NULL);
  87.     init_builtin_class(obj_MutCollClass, "<mutable-collection>",
  88.                obj_CollClass, NULL);
  89.     init_builtin_class(obj_SeqClass, "<sequence>", obj_CollClass, NULL);
  90.     init_builtin_class(obj_MutExKeyCollClass,
  91.                "<mutable-explicit-key-collection>",
  92.                obj_MutCollClass, obj_ExKeyCollClass, NULL);
  93.     init_builtin_class(obj_MutSeqClass, "<mutable-sequence>",
  94.                obj_MutCollClass, obj_SeqClass, NULL);
  95.     init_builtin_class(obj_ArrayClass, "<array>", obj_MutSeqClass, NULL);
  96.     init_builtin_class(obj_VectorClass, "<vector>", obj_ArrayClass, NULL);
  97.     init_builtin_class(obj_StringClass, "<string>", obj_MutSeqClass, NULL);
  98. }
  99.